# from django.contrib import messages
# from django.shortcuts import render,redirect
# from django.contrib.auth.forms import UserCreationForm,AuthenticationForm
# # Create your views here.
# def registe(request):
#       if request.method == 'POST':
#           form=UserCreationForm(request.POST)
#           if form.is_valid():
#               form.save()
#               messages.add_message(request,messages.SUCCESS,'注册成功')
#               return redirect('login')
#       else:
#           form = UserCreationForm()
#
#       return render(request,'rigister.html',{'form':form})
# def login(request):
#     if request.method == 'POST':
#         form = AuthenticationForm(request, data=request.POST)
#         if form.is_valid():
#             user = form.get_user()
#             login(request, user)
#             return redirect('profile')
#     else:
#         form = AuthenticationForm()
#     return render(request, 'login.html', {'form': form})